package com.steak.springmvc;

import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;

/**
 * @author 刘牌
 * @Title:
 * @date 2022-04-0421:10
 */
public class App {
    public static void run() throws LifecycleException {
        Tomcat tomcat = new Tomcat();
        Connector connector = new Connector();
        connector.setPort(8081);
        connector.setURIEncoding("UTF-8");
        tomcat.getService().addConnector(connector);
        Context context = tomcat.addContext("/",null);
        //context.addServletMappingDecoded("/api", "app");
        tomcat.start();
        //使tomcat处于阻塞状态
        tomcat.getServer().await();
    }
}
